package com.ctrl.riveradministrator.mvp.view.activity.river_info;

import android.content.Context;
import android.widget.RelativeLayout;
import android.widget.TextView;

import com.ctrl.riveradministrator.R;
import com.ctrl.riveradministrator.base.BaseListAdapter;
import com.ctrl.riveradministrator.base.BaseViewHolder;
import com.ctrl.riveradministrator.mvp.model.RiverInfo;

public class RiverInfoAdapter extends BaseListAdapter<RiverInfo> {

    private Context context;
    private TextView riverName;
    private RelativeLayout content;

    public RiverInfoAdapter(Context mContext) {
        super(mContext);
        this.context = mContext;
    }

    @Override
    public int getLayoutId() {
        return R.layout.river_info_item;
    }

    @Override
    public void onBindItemHolder(BaseViewHolder holder, int position) {
        content = holder.getView(R.id.content);
        riverName = holder.getView(R.id.river_name_tv);

        RiverInfo riverInfo = getDataList().get(position);

        riverName.setText(riverInfo.getRiverName());
        content.setOnClickListener(v -> mOnItemClickListener.onItemClick(riverInfo, position));
    }
}
